import Vue from "vue";
import VueRouter from "vue-router";

// 导入路由模块（导入的时候使用的名称可以与导出时的不一样）
import common from "@/router/modules/common";
import films from "@/router/modules/films";
import cinemas from "@/router/modules/cinemas";
import news from "@/router/modules/news";
import center from "@/router/modules/center";

// 导入vuex测试路由组件
import Vuex1 from "@/views/VuexTest/Vuex1"
import Vuex2 from "@/views/VuexTest/Vuex2"

Vue.use(VueRouter);

const routes = [
    // 公共模块的路由(common本身是数组，需要展开其中的元素)
    ...common,

    // 电影模块的路由
    ...films,

    // 影院模块的路由
    ...cinemas,

    // 资讯模块的路由
    ...news,

    // 我的模块
    ...center,

    // vuex的测试路由
    {
        path: "/vuex1",
        component: Vuex1
    },
    {
        path: "/vuex2",
        component: Vuex2
    }
];

const router = new VueRouter({
    mode: "history",
    base: process.env.BASE_URL,
    routes,
});

export default router;
